Consistency between dynamical and thermodynamical stabilities for charged self-gravitating perfect fluid