We investigate and compare the difference in the dynamics of two arrested states: colloidal glass and colloidal gel. Real-space experiments reveal two distinct nonergodicity origins for their slow dynamics, namely, cage effects for the glass and attractive bondings for the gel. Such distinct origins lead to a faster decay of the correlation function and a smaller nonergodicity parameter of the glass than those of the gel. We also find that the gel exhibits stronger dynamical heterogeneity compared with the glass due to the greater correlated motions in the gel. Moreover, a logarithmic decay in the correlation function is observed as the two nonergodicity origins merge, consistent with the mode coupling theory.