Measurement of the J/\psi meson and b-hadron production cross sections in p\barp collisions at \sqrts = 1960 GeV