Unzip the cover on the cushion you are repairing, and on the donor cushion.
Peel the covers off, turning them inside out as you remove them.
Put your hands inside of the turned covers and grasp the replacement foam through the inside-out fabric.
Slide the fabric over the replacement foam, turning it back to its right-side-out position as you go. If you are keeping the flat foam for the other chair's cushion, do this on the flat cushion too.
Zip the cover, or covers, closed.
Open the seam at the back of the cushion by cutting every third stitch, using the seam ripper. Do this on both cushions.
Peel the covers off, turning them inside out as you work.
Slide the cover onto the cushion, turning it right side out as you push the foam into it. If you are saving the cushion for the donor chair, do the same thing for both cushions.
Sew the opening closed, using the hand sewing thread and needle to make a hidden stitch, blind stitch or slip stitch.