You can ride trails with motocross bikes them but they aren't nearly as good as a bike with the right gearing. They also don't have electric start which is a big deal if you bog down on singletrack going up a hill.
The bikes you want to be looking at are the Yahama WR450, Honda CRF450X, KTM 450EXC, Kawasaki KLX450R, and a Suzuki DR-Z400 All have a wide gear ration that is required for trail riding.
The DR-Z isn't quite as nimble (weight and suspension) as the others but it's rock solid from a reliability standpoint and can still tackle tough trails. It is also better than the others as a dual sport.
You can't go wrong with any of the bikes listed above.