Hi there,
You can definitely apply via an agency. It is not going to be equivalent to a referral though. Unlike a referral, they will do some internal screening and then forward your CV if suitable. The company will then make a decision.
If you can apply via referral and have the profile the agency is looking for, I would personally go for the referral route. The person referring you is going to refer you only, while the agency is going to send your profile and a number of others for the company to screen.
If you cannot find a referral though it is fine to apply via the agency.
You can find more on referrals at the link below:
https://www.preplounge.com/en/consulting-forum/hey-everyonehope-all-is-well-3176
Best,
Francesco