If pre-clearance at DUB and therefore a domestic arrival, just walk to your departure gate and your bags will be transferred. You will pick them up on arrival at SJU.
On the remote chance that pre-clearance is closed for some reason (which it won't be), your bags will still be tagged to SJU but you will pick them up before Customs, carry them through Customs and drop them after Customs. You will then claim them at SJU.
On the return, you will check your bags at SJU and claim them at DUB.