If it is a fast enough G4, it should be able to run the applications and read the data on the hard drive. Sonnet made a PCI-SATA hard drive board that you can use on your G4 to connect the hard drive.
As for booting the G5's SATA hard drive, that is hairy at best. It may work, then again may not.
The RAM will not work.
The optical drive may work, though because it is a slot loading mechanism the power may not be right.
Before you give up on the G5's power supply, see if there are leaking capacitors, or if the PRAM battery needs replacing. The capacitors being bad, I would not use it, but the PRAM battery can often fix a seemingly dead machine.