How can I build my shoulder strength after recovering from shoulder dislocation?

Physical therapy. You should be evaluated by a Physical Therapist or an Athletic Trainer, for the best strengthening exercises for you, to minimize the chance of recurrent dislocations.
Physical Therapy. In general i recommend physical therapy. The program includes precautions to the therapist because of prior dislocation. The program also include cuff stabilization and strengthening. Assuming it was an anterior dislocation, i would have the therapist emphasize some subscapularis strengthening. The therapist would then progress you to a more vigorous program as you recover.