Robust execution of robotic tasks is a difficult problem. In many situations, these tasks involve complex behaviors combining different functionalities (e.g. perception, localization, motion planning and motion execution). These behaviors are often programmed with a strong focus on the robustness of the behavior itself, not on the definition of a ``high level'' model to be used by a task planner and an execution controller. We propose to learn behaviors models as Dynamic Bayesian Networks. Indeed, the DBN formalism allows us to learn and control behaviors with controllable parameters. We experimented our approach on a real robot, where we learned over a large number of runs the model of a complex navigation task using a modified version of Expectation Maximization for DBN. The resulting DBN is then used to control the robot navigation behavior and we show that for some given objectives (e.g. avoid failure), the learned DBN driven controller performs much better (we have one order of magnitude less failure) than the programmed controller. We believe that the proposed approach remains generic and can be used to learn complex behaviors other than navigation and for other autonomous systems.