Strictly speaking, a replicator's basic function is to take an given quantity of matter and reorganize it at the molecular level into a different material of equal mass. It's similar to the workings of the Genesis Device, actually, but on a much smaller scale (and obviously without the need for protomatter).
Since food preparation uses very few variations of the same dishes and glasses, there's probably some sort of standard (and highly pliable) material used for making all of them, and your replicator is probably going to make some sort of annoyed beeping sound or give you a verbal warning if you stick something in there it doesn't recognize (undoubtedly a built-in safety feature to avoid accidents, plus you don't want people to be able to kill their roommates and then chuck the body parts in the replicator for easy disposal).
Also, as for "converting energy into matter," the first references to the holodeck in "Encounter at Farpoint" directly implied that the holodeck didn't actually project holograms, but replicated physical facsimiles of solid objects with "much simpler patterns" than human bodies or living things. The same logic that prevents transporters from being used to crank out an infinite number of copies of, say, Commander Data obviously applies to replicators too: it's ALOT easier to store a kilogram of matter than it is to store 180 gigatons of pure energy.