They do mean the same thing; when you move the dependent clause from the back to the front of the sentence, it takes a comma, because it's an adverb dependent clause. Not all the time with the comma; just most of the time.
I understand where you are coming from, though you need to know about the different types of dependent clauses. And you need to know that certain parts of speech are used in these clauses, like relative pronouns: that, which, who, whom, etc. and subordinating conjunctions like after, when, until, etc.
I was happy because I ate dinner. (the food made you happy)
When I ate dinner, I was happy. (at the time you ate dinner you were happy)
I was happy while I ate dinner. (During dinner you were happy)
and so forth.
This is some basic stuff that covers the three subordinate (dependent) clauses: the adjective clause, adverb clause, and noun clause
This covers a lot: