I think these are both just types of cassettes, one all the rings come apart, and the other it's just one big piece all welded together.
Can someone please tell me what the difference is?
The hub is the body at the center of the wheel containing the axle. It is more or less just some bearings in a pair of cups that rotate around the axle.
The freewheel is the mechanism that locks when pedaling forward (forcing the wheel to be driven by the chain) and spins freely when coasting or pedaling backward.
Both wheels have hubs, but only the rear wheel has a freewheel.
These are two variations on freewheel design, taken from the Wikipedia article linked above:
On most modern bikes with multiple gears, the freewheel is built into the rear hub and the whole assembly is called a freehub. The cassette is just a set of gears bolted together, without any moving parts, that slides onto the hub and is held in place with a lockring.
On older bikes, the hub was just a hub with some threads on one side. The freewheel was built into the rear gear cluster and that whole assembly screwed onto the hub.
Single speed bikes are still (typically, though variations exist) built like older bikes, with the freewheel and the gear being one piece and screwing onto the hub.
If you want to read more, the Freehub article that I linked to on Wikipedia has a section comparing freewheels and freehubs.
The ever helpful Sheldon Brown also has a very detailed article (which the above photo was taken from) outlining the difference between freehubs and freewheels.