On the equivalence of cyclic and quasi-cyclic codes over finite fields