Yes, you can do that. However, some commercial programs know they have been moved to a different machine and will require that you re-enter the license key. It may be better to try cloning one machine to the other.
Just connect them by Firewire cable. Boot the computer you want to copy TO into Target Disk Mode. Boot the one you will copy FROM normally. The computer in TDM will show up on the Desktop as just another hard drive.
Now use Disk Utility to clone them:
Clone using Restore Option of Disk Utility
1. Open Disk Utility in the Utilities folder.
2. Select the destination volume from the left side list.
3. Click on the Restore tab in the DU main window.
4. Select the destination volume from the left side list and drag
it to the Destination entry field.
5. Select the source volume from the left side list and drag it to
the Source entry field.
6. Double-check you got it right, then click on the Restore button.
Destination means the TO computer. Source means the FROM computer.