Phosphorene, the single-layer form of black phosphorus, as a new member of atomically thin material family, has unique puckered atomistic structure and remarkable physical and chemical properties. In this paper, we report a discovery of an unexpected electromechanical energy conversion phenomenon-shape memory effect-in Li doped phosphorene P4Li2, using ab initio density functional theory simulations. Two stable phases are found for the two-dimensional (2D) P4Li2 crystal. Applying an external electric field can turn on or off the unique adatom switches in P4Li2 crystals, leading to a reversible structural phase transition and thereby the shape memory effect with an tunable strain output as high as 2.06%. Our results demonstrate that multiple temporary shapes are attainable in one piece of P4Li2 material, offering programmability that is particularly useful for device designs. Additionally, the P4Li2 displays superelasticity that can generate a pseudoelastic tensile strain up to 6.2%. The atomic thickness, superior flexibility, excellent electromechanical strain output, the special shape memory phenomenon, and the programmability feature endow P4Li2 with great application potential in high-efficient energy conversion at nanoscale and flexible nanoelectromechanical systems.