The relationship between IGM Lyman-alpha opacity and galaxy density near the end of reionization