Like material wise and technique. Another words, can cosmetic bonding be used to fill cavities (after decayed parts drilled away)?

I know all dentists do tooth colored filling, but can they all do it in a way that the filled part of the tooth isn't obvious (effects of cosmetic bonding)? Or must one go to a cosmetic dentist to fill a cavity on the front teeth?