This paper presents a method to imitate flatness-based controllers for mobile robots using neural networks. We present sample case studies for a unicycle mobile robot and an Unmanned Aerial Vehicle (UAV) quadcopter. The goals of this paper are to (1) train a neural network to approximate a previously designed flatness-based controller, which takes in the desired trajectories previously planned in the flatness space and robot states in a general state space, and (2) present a dynamic training approach to learn models with high dimension inputs. It is shown that a simple neural network could adequately compute the highly nonlinear state variables transformation from general state space to flatness space and replace the complicated designed heuristic to avoid the singularities in the control law. This paper also presents a new dynamic training method for models with high dimension independent inputs, serving as a reference for learning models with a multitude of inputs. Training procedures and simulations are presented to show both the effectiveness of this novel training approach and the performance of the well-trained neural network.