A microscopic model for the black hole - black string phase transition