Is it possible to install a GUI that you can start with a command and stop again?
Yes. What mostly gets in the way of that is the display manager (DM). On a desktop system, this is started at boot; it presents a graphical login, which appears again when you log out. Without a display manager running, you can start X from the console with
startx and when you log out or kill the X server, you're back to console.
Technically, the DM probably doesn't use a lot of resources. If you aren't logged in, maybe 50-100 MB of RAM (mostly X, which it depends on), and no CPU since it isn't doing anything. But it is unnecessary.
There's two things you can do. You can uninstall the display manager -- for GNOME, GDM, for KDE, KDM -- although this maybe a hassle if it's regarded as a dependency. There's no real advantage to this either, since it won't be much in terms of disk space.
The other thing is to change the nature of your default runlevel. "Runlevel" is a SysV init concept, and this won't apply on systemd (e.g fedora) or upstart (e.g. ubuntu) systems.
Traditionally, runlevel 5 was the only one that involved a GUI on linux. This has diversified and I think debian by default now uses X in everything but 1, and you don't want to use 1. You want to use one of 3, 4, or 5. However, the first thing you could try is to edit
# The default runlevel.
Change '5' to '3' and try a reboot. If you still boot to GUI, then you need to remove the DM service from runlevel 3.
To do that, you have to figure out the name of the service. Look in
/etc/rc3.d; one of the links in there will be
kdm with a prefix like
S03. If it's
update-rc.d xdm disable 2 3 4
This leaves runlevel 5 as the only DM'd runlevel, and since your default is 3, you'll have a console boot.
You can change runlevels via
telinit, which once everything is configured as above, will also allow you to start X (
telinit 5). Going back the other way won't work as well unless you set the DM to stop on other levels as per jordanm's answer. But as mentioned at the beginning, you can start X on any runlevel with
startx, which is the simplest method.