Both sentences are correct and have the same meaning but are used in different situations to make them sound natural.
"Mir fehlt ein Buch" is quite neutral and can be used in every situation.
"Warte einen Moment, mir fehlt ein Buch!" = "Wait a moment, I am missing a book"
You can use "Ein Buch fehlt mir" when someone asks WHAT you are missing.
"Was fehlt dir?" = "Ein BUCH fehlt mir". You have to put emphasis on "Buch" to make clear what you are actually missing.
But also "Mir fehlt ein Buch" would be just fine here.