Yes, you can. Connect the two machines via firewire, then boot the G5 with the T key pressed, this will boot the G5 into Target Disk Mode. It should then appear as a hard drive on your other machine.
iTunes folder is in ~/Music and the iPhoto Library is in ~/Pictures. transfer these to the same directories your new mac then hold option while opening iTunes and iPhoto and select the new libraries.