"He likes the teacher."
Translation:Er mag den Lehrer.
Yes, correct translation.
"Er gefällt mir" is slightly more sight-orientated, "Ich mag ihn" is slightly more taste-orientated.
So it is "Ich mag diesen Kuchen" - I like this cake.
But "Das Feuerwerk hat mir gefallen" - I liked the fireworks.
So "Ich mag den Lehrer" covers the meaning of "I feel attached to him", whereas "Der Lehrer gefällt mir" is something you could say at very first sight. In general both sentences are good translations of "I like the teacher"