A normality criterion for an algebra of matrices