in terms of grammar, both sentences are ok. but the two sentences emphasize different points.
i'll put these two sentences in dialogues of English so that you can get a better understanding.
For 图书馆在宿舍的前面:
-Where's the library?
-The library is in front of the dorm.
(This is probably what you want in your case, emphasizes the location of the library-WHERE)
For 宿舍的前面是图书馆:
-What's in front of the dorm?
-The library (is in front of the dorm).
(Emphasizes it is the library that lies in front of the dorm-WHAT)
-native speaker here, hope this help :)