Yields of prompt and non-prompt J/psi ,as well as Upsilon(1S) mesons, are measured by the CMS experiment via their mu(+)mu(-) decays in PbPb and pp collisions at root s(NN) - 2.76TeV for quarkonium rapidity |y| < 2.4. Differential cross sections and nuclear modification factors are reported as functions of y and transverse momentum p(T), as well as collision centrality. For prompt J/psi with relatively high p(T) (6.5 < p(T) < 30 GeV/c), a strong, centrality-dependent suppression is observed in PbPb collisions, compared to the yield in pp collisions scaled by the number of inelastic nucleon-nucleon collisions. In the same kinematic range, a suppression of non-prompt J/psi, which is sensitive to the in-medium b-quark energy loss, is measured for the first time. Also the low-p(T) Upsilon(1S) mesons are suppressed in PbPb collisions.