Learning Barrier-Certified Polynomial Dynamical Systems for Obstacle Avoidance with Robots