Process by which exogenous DNA is taken up by recipient cells, sphaeroplasts or protoplasts. The DNA may be in the form of plasmids that can replicate autonomously, or may be a fragment that can integrate into the host chromosomes. Transformation can occur naturally in some bacteria, but in other bacteria and eukaryotic microorganisms, it can only occur after cells have been permeabilized by artificial methods. Also refers to conversion of cultured cells to a malignant phenotype.