  We study the role of quantum statistics in the self-ordering of ultracold
bosons and fermions moving inside an optical resonator with transverse coherent
pumping. For few particles we numerically compute the nonequilibrium dynamics
of the density matrix towards the self-ordered stationary state of the coupled
atom-cavity system. We include quantum fluctuations of the particles and the
cavity field. These fluctuations in conjunction with cavity cooling determine
the stationary distribution of the particles, which exhibits a transition from
a homogeneous to a spatially ordered phase with the appearance of a
superradiant scattering peak in the cavity output spectrum. At the same time
the cavity field $Q$-function changes from a single to a double peaked
distribution. While the ordering threshold is generally lower for bosons, we
confirm the recently predicted zero pump strength threshold for superradiant
scattering for fermions when the cavity photon momentum coincides with twice
the Fermi momentum.
