Yes, they are both correct.
The style of beginning a sentence with 'but' or 'and' is frowned upon by some editors and writers, but their numbers are fewer and fewer. Most style guides accept this now, and some even recommend it in some cases.
If, however, your editor or professor is picky about this, and somewhat inflexible, you'd better stick with the outdated rule that we shouldn't begin sentences with 'but.'
But, I and most of my colleagues think that this rule is not a good one.