It can be either, or both
The DM can call for the Surge, or not call for it, at DM discretion.
"Both" is a well supported ruling.
Wild Magic Surge says (PHB p. 103)
... your spell casting can unleash surges of untamed magic.
Immediately after you cast a sorcerer spell ... the DM can have you
roll a d20.
From the Ring of Spell Storing text
This ring stores spells cast into it ...
While wearing this ring, you can cast any spell stored in it.
Whenever there is "casting" by the Wild Magic Sorcerer, for spell of level 1 or higher, the DM can call for that roll.
Can versus must
There is no rule that the DM must call for the Wild Magic roll, the DM can. This is a complaint some people have with this sub class of Sorcerer, that this class feature is subject to a DM ruling each time a die roll may be called for.
Since it isn't a hard and fast rule -- if this, then that -- the true but unsatisfying answer to your question is "if the DM prefers before and after, so be it. If the DM prefers before, so be it. If the DM prefers after, so be it."
Why "cast from ring" makes good sense if you only want one trigger
The Sorcerer can cast from the ring regardless of who loaded the ring. If another sorcerer, or another caster, filled the ring, the sorcerer with the ring doesn't cast it (and would not trigger the effect) until casting from the ring. If what you'd like is to keep it simple at your table -- KISS principle -- triggering the roll chance when the spell is cast from the ring makes sense.
Crazy Fun Method
If you are in a low combat / high non-combat encounter mode, there is room for a lot of hilarity/fear with this feature. If, for example, while the sorcerer is filling the ring (say, at a tavern) a wild magic surge goes off, blows up the room (or what ever) it can add to the RP and interaction with the town.
What would your players prefer? Talk to them. Some groups like random stuff like that. Some don't.
Rule of cool/Rules as Fun
If you are the DM,
That's up to the DM, but I'd recommend working with your player on getting the feel right for your table.