Yes, you can absolutely do this, with or without the battery being in the car.
If you think about it, many cables aren't capable of providing enough juice from one car to another. When you attach them, you cannot attempt to start the receiving car right away ... you have to let the donor car run while attached to the receiving car. When you're doing this, you're actually charging the battery. Once the dead battery has enough juice from the donor car (has been recharged a certain amount), then you try it, the partially recharged battery as well as the amount of juice through the cables gives you enough to start the vehicle. If you left a battery in this mode for a while, it would be completely recharged.
Here's the thing though. There's a couple of problems with doing this. The problem is it is HIGHLY inefficient. You'd be doing a lot better by putting the dead battery on a charger and letting it charge easily. Secondly, it really isn't good for the donor car to completely recharge the battery using this method. While you could possibly do this, the problem lies in the fact the donor car has to be left idling for a long time, which really isn't good for the car nor is it good for the environment.