In theory there is - using a KVM switch setup.This is a "junction" box into which your keyboard,monitor and mouse are plugged with leads then going to each PC and you're supposed to be able to switch between the 2 PC's by hotkey.
I've just built a new PC so bought one of these to do the same as you propose. A week later I'm still trying to get it to function correctly. I do know someone whose KVM works quite happily but I haven't cracked it yet. I bought the Belkin setup and the little manual states that some special keyboard/mouseware can cause it not to work correctly.